﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Controller;
using Model;

namespace Biffen
{
    public partial class EventUI : Form
    {
        List<Movie> movies = new List<Movie>();
        MovieCtr movieCtr = new MovieCtr();

        public EventUI()
        {
            InitializeComponent();

            movies = movieCtr.GetAllMovies();

            List<String> list = new List<string>();

            foreach (Movie m in movies)
            {
                list.Add(m.Title);
            }

            movieList.DataSource = list;
        }

        private void movieList_SelectedIndexChanged(object sender, EventArgs e)
        {
            int index = movieList.SelectedIndex;
            Movie movie = null;
            if (index >= 0)
            {
                movie = movies[index];
                if (movie != null)
                {
                    movieTitleHeader.Text = movie.Title;
                }
            }
        }
    }
}
